package com.thoughtservice.jspdoc.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class GenerateUtils {
	
	private final static Logger LOG = LoggerFactory.getLogger(GenerateUtils.class);

	/**
	 * Compute some type of path
	 * @return java.lang.String
	 * @param path java.lang.String
	 * @param Root java.lang.String
	 */
	public static String getRootRelPath(String p, String Root) {
		LOG.trace("Entering {}", "getRootRelPath");		
//		String path = p.substring(Root.length() + 1, p.length());
		String path = p.substring(Root.length(), p.length());
		path = path.replace('\\', '/');
		String rel = "";
		for (int ind = 0; ind < path.length(); ind++) {
			if (path.charAt(ind) == '/') {
				rel += "../";
			}
		}
		LOG.trace("Exiting {}", "getRootRelPath");
		return rel;
	}

}
